export function baseRequest(options) {
	return new Promise((resolve, reject) => {
		uni.request({
			url: options.url,
			method: options.method || 'GET',
			data: options.data || {},
			header: {
				"content-type": "application/json:charset=UTF-8"
			},
			success: (res) => {
				// console.log(res);
				resolve(res)
			},
			fail: (err) => {
				uni.$showMsg()
				reject(err)
			}
		})
	})
}

export function p(url, data = {}) {
	return baseRequest({
		url,
		data,
		method: 'POST'
	})
}

export function g(url, data = {}) {
	return baseRequest({
		url,
		data,
		method: 'GET'
	})
}